package com.kucai.yifaqapp.presenter.activity;

import com.kucai.yifaqapp.global.HttpAdress;
import com.kucai.yifaqapp.model.CustomObserver;
import com.kucai.yifaqapp.model.network.HttpJsonUtils;
import com.kucai.yifaqapp.model.network.entity.res.ResNow;
import com.kucai.yifaqapp.ui.activity.NowActivity;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/11/30.
 */

public class NowActivityPresenter extends BaseActivityPresenter<NowActivity> {
    public NowActivityPresenter(NowActivity mActivity) {
        super(mActivity);
    }

    /**
     * 今日已结
     */
    public void getnow(String token,String datatime,String nows) {
        HttpJsonUtils.getHttpApiInstance()
                .getnow(HttpAdress.getuseAdress() + "api/mobile/lottery/getSettled",token,datatime,nows)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<ResNow>(mActivity) {
                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {
                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {

                    }

                    @Override
                    protected void onCustomNext(ResNow resNote) {
                        if (null != resNote.data) {
                            mActivity.getdata(resNote);
                        }
                    }
                });
    }
}
